home *** CD-ROM | disk | FTP | other *** search
/ Aminet 3 / Aminet 3 - July 1994.iso / Aminet / dev / obero / Interfaces3_4.lha / Interfaces / ARP.mod < prev    next >
Text File  |  1993-12-28  |  57KB  |  1,153 lines

  1. (*
  2. (*
  3. **  Amiga Oberon Library Module: ARP
  4. **
  5. **   © 1993 by Fridtjof Siebert
  6. **
  7. **  $VER: Arp.mod 39.1 (2.11.92)
  8. *)
  9. *)
  10. (*
  11.  ************************************************************************
  12.  *                                                                      *
  13.  * 21/2/90      Arp.mod         ported to Oberon by Fridtjof Siebert    *
  14.  *                                                                      *
  15.  * 5/3/89       ARPbase.h       by MKSoft from ARPbase.i by SDB         *
  16.  *                                                                      *
  17.  ************************************************************************
  18.  *                                                                      *
  19.  *      AmigaDOS Resource Project -- Library Module File                *
  20.  *                                   for the AMOK Oberon Compiler       *
  21.  *                                                                      *
  22.  ************************************************************************
  23.  *                                                                      *
  24.  *      Copyright (c) 1987/1988/1989 by Scott Ballantyne                *
  25.  *                                                                      *
  26.  *      The arp.library, and related code and files may be freely used  *
  27.  *      by supporters of ARP.  Modules in the arp.library may not be    *
  28.  *      extracted for use in independent code, but you are welcome to   *
  29.  *      provide the arp.library with your work and call on it freely.   *
  30.  *                                                                      *
  31.  *      You are equally welcome to add new functions, improve the ones  *
  32.  *      within, or suggest additions.                                   *
  33.  *                                                                      *
  34.  *      BCPL programs are not welcome to call on the arp.library.       *
  35.  *      The welcome mat is out to all others.                           *
  36.  *                                                                      *
  37.  ************************************************************************
  38.  *)
  39.  
  40. MODULE ARP;
  41.  
  42. (*
  43.  ************************************************************************
  44.  *      First we need to import the Amiga Interface Modules             *
  45.  ************************************************************************
  46.  *)
  47.  
  48. IMPORT e := Exec,
  49.        d := Dos,
  50.        I := Intuition,
  51.        g := Graphics,
  52.        s := SYSTEM;
  53.  
  54. (*
  55.  ************************************************************************
  56.  *      Standard definitions for arp library information                *
  57.  ************************************************************************
  58.  *)
  59.  
  60. CONST
  61.  arpName     * =   "arp.library";   (* Name of library... *)
  62.  arpVersion  * =   39;              (* Current version... *)
  63.  
  64.  
  65. (*
  66.  ************************************************************************
  67.  *      Forward declaration of some Pointers:                           *
  68.  ************************************************************************
  69.  *)
  70.  
  71. TYPE
  72.   ArpBasePtr * = UNTRACED POINTER TO ArpBase;
  73.   EnvBasePtr * = UNTRACED POINTER TO EnvBase;
  74.   FileRequesterPtr * = UNTRACED POINTER TO FileRequester;
  75.   AChainPtr * = UNTRACED POINTER TO AChain;
  76.   DirectoryEntryPtr * = UNTRACED POINTER TO DirectoryEntry;
  77.   TrackedResourcePtr * = UNTRACED POINTER TO TrackedResource;
  78.   DefaultTrackerPtr * = UNTRACED POINTER TO DefaultTracker;
  79.   ResListPtr * = UNTRACED POINTER TO ResList;
  80.   ZombieMsgPtr * = UNTRACED POINTER TO ZombieMsg;
  81.   ResidentProgramNodePtr * = UNTRACED POINTER TO ResidentProgramNode;
  82.   ProcessControlBlockPtr * = UNTRACED POINTER TO ProcessControlBlock;
  83.   AnchorPathPtr * = UNTRACED POINTER TO AnchorPath;
  84.  
  85. (*
  86.  ************************************************************************
  87.  *      The current ARP library node...                                 *
  88.  ************************************************************************
  89.     stamp* : d.Date;         (* DOS Datestamp                        *)
  90.     format* : s.BYTE;        (* controls appearance ot dat_StrDate   *)
  91.     flags* : SET;            (* See BITDEF's below                   *)
  92.     strDay* : e.ADDRESS;     (* day of the week string               *)
  93.     strData* : e.ADDRESS;    (* date string                          *)
  94.     strTime* : e.ADDRESS;    (* time string                          *)
  95.   END;
  96.  *)
  97.  
  98. TYPE
  99.   ArpBase * = STRUCT (libNode *: e.Library)(* Standard library node    *)
  100.     dosRootNode* :     d.RootNodePtr;      (* Copy of dl_Root          *)
  101.     flags* :           SHORTSET;           (* See bitdefs below        *)
  102.     escChar* :         CHAR;               (* Character for escaping   *)
  103.     arpReserved1* :    LONGINT;            (* ArpLib's use only!!      *)
  104.     envBase* :         e.LibraryPtr;       (* Dummy library for MANX   *)
  105.     dosBase* :         d.DosLibraryPtr;    (* Cached DosBase           *)
  106.     gfxBase* :         g.GfxBasePtr;       (* Cached GfxBase           *)
  107.     intuiBase* :       I.IntuitionBasePtr; (* Cached IntuitionBase     *)
  108.     resLists* :        e.MinList;          (* Resource trackers        *)
  109.     residentPrgList* : ResidentProgramNodePtr; (* Resident Programs.   *)
  110.     resPrgProtection* :e.SignalSemaphore;  (* protection for above     *)
  111.     segList* :         e.BPTR;             (* Ptr to loaded lib (BPTR) *)
  112.   END;
  113.  
  114.  
  115. (*
  116.  ************************************************************************
  117.  *      The following is here *ONLY* for information and for            *
  118.  *      compatibility with MANX.  DO NOT use in new code!               *
  119.  ************************************************************************
  120.  *)
  121.  
  122.   EnvBase * = STRUCT
  123.     libNode* : e.Library;      (* Standard library node for linkage    *)
  124.     envSpace* : e.ADDRESS;     (* Access only when Forbidden!          *)
  125.     envSize* : LONGINT;        (* Total allocated mem for EnvSpace     *)
  126.     arpbase* : ArpBasePtr;     (* Added in V32 for Resource Tracking   *)
  127.   END;
  128.  
  129. (*
  130.  ************************************************************************
  131.  *      These are used in release 33.4 but not by the library code.     *
  132.  *      Instead, individual programs check for these flags.             *
  133.  ************************************************************************
  134.  *)
  135.  
  136. CONST  (* ArpBase.flags: *)
  137.  
  138.   arpWildWorld * = 0; (* Mixed BCPL/Normal wildcards. *)
  139.   arpWildBCPL  * = 1; (* Pure BCPL wildcards.         *)
  140.  
  141. (*
  142.  ************************************************************************
  143.  * The alert object is what you use if you really must return an alert  *
  144.  * to the user. You would normally OR this with another alert number    *
  145.  * from the alerts.h file. Generally, should be NON deadend alerts.     *
  146.  *                                                                      *
  147.  * For example, if you can't open ArpLibrary:                           *
  148.  *      Alert( (AG_OpenLib|AO_ArpLib), 0L);                             *
  149.  ************************************************************************
  150.  *)
  151.  
  152.   aoArpLib     * = 00008036H;           (* Alert object *)
  153.  
  154. (*
  155.  ************************************************************************
  156.  *      Alerts that arp.library may return...                           *
  157.  ************************************************************************
  158.  *)
  159.  
  160.   deadEnd * = MIN(LONGINT);
  161.  
  162.   anArpLib       * =           03600000H; (* Alert number              *)
  163.   anArpNoMem     * =           03610000H; (* No more memory            *)
  164.   anArpInputMem  * =           03610002H; (* No memory for input buffer*)
  165.   anArpNoMakeEnv * = deadEnd + 03610003H; (* No memory to make EnvLib  *)
  166.  
  167.   anArpNoDOS     * = deadEnd + 03630001H; (* Can't open dos.library    *)
  168.   anArpNoGfx     * = deadEnd + 03630002H; (* Can't open gfx.library    *)
  169.   anArpNoIntuit  * = deadEnd + 03630003H; (* Can't open intuition      *)
  170.   anBadPackBlues * = deadEnd + 03640000H; (* Bad packet to SendPacket()*)
  171.   anZombie       * = deadEnd + 03600003H; (* Zombie roaming around sys.*)
  172.  
  173.   anArpScattered * = deadEnd + 03600002H; (* Scatter load not allowed  *)
  174.  
  175. (*
  176.  ************************************************************************
  177.  *      Return codes you can get from calling ARP Assign()...           *
  178.  ************************************************************************
  179.  *)
  180.  
  181. CONST
  182.   assignOK      * = 0;      (* Everything is cool and groovey          *)
  183.   assignNODEV   * = 1;      (* "Physical" is not valid for assignment  *)
  184.   assignFATAL   * = 2;      (* Something really icky happened          *)
  185.   assignCANCEL  * = 3;      (* Tried to cancel something but it didn't *)
  186.  
  187. (*
  188.  ************************************************************************
  189.  *      Size of buffer you need if you are going to call ReadLine()     *
  190.  ************************************************************************
  191.  *)
  192.  
  193.   maxInputBuf   * = 256;
  194.  
  195. (*
  196.  ************************************************************************
  197.  *      The ARP file requester data structure...                        *
  198.  ************************************************************************
  199.  *)
  200.  
  201. TYPE
  202.   FileRequester * = STRUCT
  203.     hail* :   e.ADDRESS;              (* Hailing text                 *)
  204.     file* :    e.ADDRESS;             (* Filename array (FCHARS + 1)  *)
  205.     dir* :    e.ADDRESS;              (* Directory array (DSIZE + 1)  *)
  206.     window* : I.WindowPtr;            (* Window requesting or NULL    *)
  207.     funcFlags* : SHORTSET;            (* Set bitdef's below           *)
  208.     flags2* : SHORTSET;               (* New flags...                 *)
  209.     function* : PROCEDURE();          (* Your function, see bitdef's  *)
  210.     leftEdge* : INTEGER;              (* To be used later...          *)
  211.     topEdge* : INTEGER;
  212.   END;
  213.  
  214.  
  215.  
  216. (*
  217.  ************************************************************************
  218.  * The following are the defines for fr_FuncFlags.  These bits tell     *
  219.  * FileRequest() what your fr_UserFunc is expecting, and what           *
  220.  * FileRequest() should call it for.                                    *
  221.  *                                                                      *
  222.  * You are called like so:                                              *
  223.  * fr_Function(Mask, Object)                                            *
  224.  * ULONG        Mask;                                                   *
  225.  * CPTR         *Object;                                                *
  226.  *                                                                      *
  227.  * The Mask is a copy of the flag value that caused FileRequest() to    *
  228.  * call your function. You can use this to determine what action you    *
  229.  * need to perform, and exactly what Object is, so you know what to do  *
  230.  * and what to return.                                                  *
  231.  ************************************************************************
  232.  *)
  233.  
  234. CONST
  235.  
  236.   doWildFunc  * = 7; (* Call me with a FIB and a name, 0 return accepts*)
  237.   doMsgFunc   * = 6; (* You get all IDCMP messages not for FileRequest *)
  238.   doColor     * = 5; (* Set this bit for that new and different look   *)
  239.   newIDCMP    * = 4; (* Force a new IDCMP (only if fr_Window != NULL)  *)
  240.   newWindFunc * = 3; (* You get to modify the newwindow structure.     *)
  241.   addGadFunc  * = 2; (* You get to add gadgets.                        *)
  242.   gEventFunc  * = 1; (* Function to call if one of your gadg is selectd*)
  243.   listFunc    * = 0; (* Not implemented yet.                           *)
  244.  
  245. (*
  246.  ************************************************************************
  247.  * The FR2B_ bits are for fr_Flags2 in the file requester structure     *
  248.  ************************************************************************
  249.  *)
  250.  
  251.   longPath * = 0; (* Specify the fr_Dir buffer is 256 bytes long *)
  252.  
  253. (*
  254.  ************************************************************************
  255.  *      The sizes of the different buffers...                           *
  256.  ************************************************************************
  257.  *)
  258.  
  259.   fChars     * =     32; (* Filename size                              *)
  260.   dSize      * =     33; (* Directory name size if not FR2B_LongPath   *)
  261.  
  262.   longDSize  * =    254; (* If FR2B_LongPath is set, use LONG_DSIZE    *)
  263.   longFSize  * =    126; (* For compatibility with ARPbase.i           *)
  264.  
  265.   firstGadget * = 7680H; (* User gadgetID's must be < this value       *)
  266.  
  267. (*
  268.  ************************************************************************
  269.  * Structure expected by FindFirst()/FindNext()                         *
  270.  *                                                                      *
  271.  * You need to allocate this structure and initialize it as follows:    *
  272.  *                                                                      *
  273.  * Set ap_BreakBits to the signal bits (CDEF) that you want to take a   *
  274.  * break on, or NULL, if you don't want to convenience the user.        *
  275.  *                                                                      *
  276.  * if you want to have the FULL PATH NAME of the files you found,       *
  277.  * allocate a buffer at the END of this structure, and put the size of  *
  278.  * it into ap_StrLen.  If you don't want the full path name, make sure  *
  279.  * you set ap_StrLen to zero.  In this case, the name of the file, and  *
  280.  * stats are available in the ap_Info, as per usual.                    *
  281.  *                                                                      *
  282.  * Then call FindFirst() and then afterwards, FindNext() with this      *
  283.  * structure.  You should check the return value each time (see below)  *
  284.  * and take the appropriate action, ultimately calling                  *
  285.  * FreeAnchorChain() when there are no more files and you are done.     *
  286.  * You can tell when you are done by checking for the normal AmigaDOS   *
  287.  * return code ERROR_NO_MORE_ENTRIES.                                   *
  288.  *                                                                      *
  289.  * You will also have to check the DirEntryType variable in the ap_Info *
  290.  * structure to determine what exactly you have received.               *
  291.  ************************************************************************
  292.  *)
  293.  
  294. TYPE
  295.   AnchorPath * = STRUCT
  296.     base* : AChainPtr;       (* Pointer to first anchor                *)
  297.     last* : AChainPtr;       (* Pointer to last anchor                 *)
  298.     breakBits* : LONGSET;    (* Bits to break on                       *)
  299.     foundBreak* : LONGSET;   (* Bits we broke on. returns ERROR_BREAK  *)
  300.     flags* : SHORTSET;       (* New use for the extra word...          *)
  301.     reserved* : s.BYTE;      (* To fill it out...                      *)
  302.     strLen* : INTEGER;       (* This is what used to be ap_Length      *)
  303.     info* : d.FileInfoBlock;
  304. (*  buf* : ARRAY OF s.BYTE; *)(* Allocate a buffer here, if desired     *)
  305.   END;
  306.  
  307. (*
  308.  ************************************************************************
  309.  *      Bit definitions for the new ap_Flags...                         *
  310.  ************************************************************************
  311.  *)
  312.  
  313. CONST
  314.   doWild    * =  0;    (* User option ALL                              *)
  315.   itsWild   * =  1;    (* Set by FindFirst, used by FindNext           *)
  316.   doDir     * =  2;    (* Bit is SET if a DIR node should be entered   *)
  317.                        (* Application can RESET this bit to AVOID      *)
  318.                        (* entering a dir.                              *)
  319.   didDir    * =  3;    (* Bit is set for an "expired" dir node         *)
  320.   noMemErr  * =  4;    (* Set if there was not enough memory           *)
  321.   doDot     * =  5;    (* If set, '.' (DOT) will convert to CurrentDir *)
  322.  
  323. (*
  324.  ************************************************************************
  325.  * Structure used by the pattern matching functions, no need to obtain, *
  326.  * diddle or allocate this yourself.                                    *
  327.  *                                                                      *
  328.  * Note:  If you did, you will now break as it has changed...           *
  329.  ************************************************************************
  330.  *)
  331.  
  332. TYPE
  333.   AChain * = STRUCT
  334.              child* : AChainPtr;
  335.              paren* : AChainPtr;
  336.              lock* :  d.FileLockPtr;
  337.              info* :  d.FileInfoBlockPtr;
  338.              flags* : SHORTSET;
  339.              string* :ARRAY 1 OF CHAR;   (* Just as is .i file   *)
  340.            END;                          (* ???  Don't use this! *)
  341.  
  342. CONST
  343.  
  344.   patternBit  * = 0;
  345.   examinedBit * = 1;
  346.   completed   * = 2;
  347.   allBit      * = 3;
  348.  
  349. (*
  350.  ************************************************************************
  351.  * Constants used by wildcard routines                                  *
  352.  *                                                                      *
  353.  * These are the pre-parsed tokens referred to by pattern match.  It    *
  354.  * is not necessary for you to do anything about these, FindFirst()     *
  355.  * FindNext() handle all these for you.                                 *
  356.  ************************************************************************
  357.  *)
  358.  
  359. CONST
  360.   any      * =  80X;   (* Token for '*' | '#?' *)
  361.   single   * =  81X;   (* Token for '?'        *)
  362.  
  363. (*
  364.  ************************************************************************
  365.  * No need to muck with these as they may change...                     *
  366.  ************************************************************************
  367.  *)
  368.  
  369. CONST
  370.  
  371.   orStart    * =  82X;  (* Token for '('        *)
  372.   orNext     * =  83X;  (* Token for '|'        *)
  373.   OrEnd      * =  84X;  (* Token for ')'        *)
  374.   not        * =  85X;  (* Token for '~'        *)
  375.   notClass   * =  87X;  (* Token for '^'        *)
  376.   class      * =  88X;  (* Token for '[]'       *)
  377.   repBeg     * =  89X;  (* Token for '['        *)
  378.   repEnd     * =  8AX;  (* Token for ']'        *)
  379.  
  380. (*
  381.  ************************************************************************
  382.  * Structure used by AddDANode(), AddDADevs(), FreeDAList().            *
  383.  *                                                                      *
  384.  * This structure is used to create lists of names, which normally      *
  385.  * are devices, assigns, volumes, files, or directories.                *
  386.  ************************************************************************
  387.  *)
  388.  
  389. TYPE
  390.   DirectoryEntry * = STRUCT
  391.     next* : DirectoryEntryPtr;  (* Next in list                       *)
  392.     type* : SHORTINT;           (* DLX_mumble                         *)
  393.     flags* : SHORTSET;          (* For future expansion, DO NOT USE!  *)
  394.     name* : ARRAY 256 OF CHAR;  (* The name of the thing found        *)
  395.   END;
  396.  
  397. (*
  398.  ************************************************************************
  399.  * Defines you use to get a list of the devices you want to look at.    *
  400.  * For example, to get a list of all directories and volumes, do:       *
  401.  *                                                                      *
  402.  *      AddDADevs( mydalist, (DLF_DIRS | DLF_VOLUMES) )                 *
  403.  *                                                                      *
  404.  * After this, you can examine the de_type field of the elements added  *
  405.  * to your list (if any) to discover specifics about the objects added. *
  406.  *                                                                      *
  407.  * Note that if you want only devices which are also disks, you must    *
  408.  * (DLF_DEVICES | DLF_DISKONLY).                                        *
  409.  ************************************************************************
  410.  *)
  411.  
  412. CONST
  413.   devices   * =  0;  (* Return devices                               *)
  414.   diskOnly  * =  1;  (* Modifier for above: Return disk devices only *)
  415.   volumes   * =  2;  (* Return volumes only                          *)
  416.   dirs      * =  3;  (* Return assigned devices only                 *)
  417.  
  418. (*
  419.  ************************************************************************
  420.  * Legal de_Type values, check for these after a call to AddDADevs(),   *
  421.  * or use on your own as the ID values in AddDANode().                  *
  422.  ************************************************************************
  423.  *)
  424.  
  425.   file      * = 0H;     (* AddDADevs() can't determine this     *)
  426.   dir       * = 8H;     (* AddDADevs() can't determine this     *)
  427.   device    * = 16H;    (* It's a resident device               *)
  428.  
  429.   volume    * = 24H;    (* Device is a volume                   *)
  430.   ummounted * = 32H;    (* Device is not resident               *)
  431.  
  432.   assign    * = 40H;    (* Device is a logical assignment       *)
  433.  
  434. (*
  435.  ************************************************************************
  436.  *      Resource Tracking stuff...                                      *
  437.  ************************************************************************
  438.  *                                                                      *
  439.  * There are a few things in arp.library that are only directly         *
  440.  * acessable from assembler.  The glue routines provided by us for      *
  441.  * all 'C' compilers use the following conventions to make these        *
  442.  * available to C programs.  The glue for other language's should use   *
  443.  * as similar a mechanism as possible, so that no matter what language  *
  444.  * or compiler we speak, when talk about arp, we will know what the     *
  445.  * other guy is saying.                                                 *
  446.  *                                                                      *
  447.  * Here are the cases:                                                  *
  448.  *                                                                      *
  449.  * Tracker calls...                                                     *
  450.  *              These calls return the Tracker pointer as a secondary   *
  451.  *              result in the register A1.  For C, there is no clean    *
  452.  *              way to return more than one result so the tracker       *
  453.  *              pointer is returned in IoErr().  For ease of use,       *
  454.  *              there is a define that typecasts IoErr() to the correct *
  455.  *              pointer type.  This is called LastTracker and should    *
  456.  *              be source compatible with the earlier method of storing *
  457.  *              the secondary result.                                   *
  458.  *                                                                      *
  459.  * GetTracker() -                                                       *
  460.  *              Syntax is a bit different for C than the assembly call  *
  461.  *              The C syntax is GetTracker(ID).  The binding routines   *
  462.  *              will store the ID into the tracker on return.  Also,    *
  463.  *              in an effort to remain consistant, the tracker will     *
  464.  *              also be stored in LastTracker.                          *
  465.  *                                                                      *
  466.  * In cases where you have allocated a tracker before you have obtained *
  467.  * a resource (usually the most efficient method), and the resource has *
  468.  * not been obtained, you will need to clear the tracker id.  The macro *
  469.  * CLEAR_ID() has been provided for that purpose.  It expects a pointer *
  470.  * to a DefaultTracker sort of struct.                                  *
  471.  ************************************************************************
  472.  
  473. #define CLEAR_ID(t)     ((SHORT * ) t)[-1]* =NULL
  474.  
  475.  ************************************************************************
  476.  * You MUST prototype IoErr() to prevent the possible error in defining *
  477.  * IoErr() and thus causing LastTracker to give you trash...            *
  478.  *                                                                      *
  479.  * N O T E !  You MUST! have IoErr() defined as LONG to use LastTracker *
  480.  *            If your compiler has other defines for this, you may wish *
  481.  *            to remove the prototype for IoErr().                      *
  482.  ************************************************************************
  483.  
  484. #define LastTracker     ((struct DefaultTracker * )IoErr())
  485.  
  486.  ************************************************************************
  487.  * The rl_FirstItem list (ResList) is a list of TrackedResource (below) *
  488.  * It is very important that nothing in this list depend on the task    *
  489.  * existing at resource freeing time (i.e., RemTask(0L) type stuff,     *
  490.  * DeletePort() and the rest).                                          *
  491.  *                                                                      *
  492.  * The tracking functions return a struct Tracker *Tracker to you, this *
  493.  * is a pointer to whatever follows the tr_ID variable.                 *
  494.  * The default case is reflected below, and you get it if you call      *
  495.  * GetTracker() ( see DefaultTracker below).                            *
  496.  *                                                                      *
  497.  * NOTE: The two user variables mentioned in an earlier version don't   *
  498.  * exist, and never did. Sorry about that (SDB).                        *
  499.  *                                                                      *
  500.  * However, you can still use ArpAlloc() to allocate your own tracking  *
  501.  * nodes and they can be any size or shape you like, as long as the     *
  502.  * base structure is preserved. They will be freed automagically just   *
  503.  * like the default trackers.                                           *
  504.  ************************************************************************
  505.  *)
  506.  
  507. TYPE TrackedResource * = STRUCT
  508.        node* : e.MinNode;   (* Double linked pointer                *)
  509.        flags* : SHORTSET;   (* Don't touch                          *)
  510.        lock* : s.BYTE;      (* Don't touch, for Get/FreeAccess()    *)
  511.        id* : INTEGER;       (* Item's ID                            *)
  512. (*
  513.  ************************************************************************
  514.  * The struct DefaultTracker *Tracker portion of the structure.         *
  515.  * The stuff below this point can conceivably vary, depending           *
  516.  * on user needs, etc.  This reflects the default.                      *
  517.  ************************************************************************
  518.  *)
  519.  
  520.        object* : e.ADDRESS; (* The thing being tracked              *)
  521.        extra* :  e.ADDRESS; (* Only needed sometimes                *)
  522.      END;
  523.  
  524.  
  525. (*
  526.  ************************************************************************
  527.  * You get a pointer to a struct of the following type when you call    *
  528.  * GetTracker().  You can change this, and use ArpAlloc() instead of    *
  529.  * GetTracker() to do tracking. Of course, you have to take a wee bit   *
  530.  * more responsibility if you do, as well as if you use TRAK_GENERIC    *
  531.  * stuff.                                                               *
  532.  *                                                                      *
  533.  * TRAK_GENERIC folks need to set up a task function to be called when  *
  534.  * an item is freed.  Some care is required to set this up properly.    *
  535.  *                                                                      *
  536.  * Some special cases are indicated by the unions below, for            *
  537.  * TRAK_WINDOW, if you have more than one window opened, and don't      *
  538.  * want the IDCMP closed particularly, you need to set a ptr to the     *
  539.  * other window in dt_Window2.  See CloseWindowSafely() for more info.  *
  540.  * If only one window, set this to NULL.                                *
  541.  ************************************************************************
  542.  *)
  543.  
  544. TYPE DefaultTracker * = STRUCT;
  545.        object* : e.ADDRESS;     (* The object being tracked  *)
  546.        extra* :  e.ADDRESS;
  547.      END;
  548.  
  549. (*
  550.  ************************************************************************
  551.  *      Items the tracker knows what to do about                        *
  552.  ************************************************************************
  553.  *)
  554.  
  555. CONST
  556.   aAMem    * =  0;      (* Default (ArpAlloc) element           *)
  557.   lock     * =  1;      (* File lock                            *)
  558.   trFile   * =  2;      (* Opened file                          *)
  559.   window   * =  3;      (* Window -- see docs                   *)
  560.   screen   * =  4;      (* Screen                               *)
  561.   library  * =  5;      (* Opened library                       *)
  562.   dAMem    * =  6;      (* Pointer to DosAllocMem block         *)
  563.   memNode  * =  7;      (* AllocEntry() node                    *)
  564.   segList  * =  8;      (* Program segment                      *)
  565.   resList  * =  9;      (* ARP (nested) ResList                 *)
  566.   mem      * =  10;     (* Memory ptr/length                    *)
  567.   generic  * =  11;     (* Generic Element, your choice         *)
  568.   dAList   * =  12;     (* DAlist ( aka file request )          *)
  569.   anchor   * =  13;     (* Anchor chain (pattern matching)      *)
  570.   fReq     * =  14;     (* FileRequest struct                   *)
  571.   font     * =  15;     (* GfxBase CloseFont()                  *)
  572.   max      * =  15;     (* Poof, anything higher is tossed      *)
  573.  
  574.   unlink   * =   7;     (* Free node bit                        *)
  575.   reloc    * =   6;     (* This may be relocated (not used yet) *)
  576.   moved    * =   5;     (* Item moved                           *)
  577.  
  578. (*
  579.  ************************************************************************
  580.  * Note: ResList MUST be a DosAllocMem'ed list!, this is done for       *
  581.  * you when you call CreateTaskResList(), typically, you won't need     *
  582.  * to access/allocate this structure.                                   *
  583.  ************************************************************************
  584.  *)
  585.  
  586. TYPE
  587.   ResList * = STRUCT
  588.     node* : e.MinNode;        (* Used by arplib to link reslists      *)
  589.     taskid* : e.TaskPtr;      (* Owner of this list                   *)
  590.     firstItem* : e.MinList;   (* List of Tracked Resources            *)
  591.     link* : ResListPtr;       (* SyncRun's use - hide list here       *)
  592.   END;
  593.  
  594. (*
  595.  ************************************************************************
  596.  *      Returns from CompareLock()                                      *
  597.  ************************************************************************
  598.  *)
  599.  
  600. CONST
  601.  
  602.   equal    * = 0;  (* The two locks refer to the same object       *)
  603.   clVolume * = 1;  (* Locks are on the same volume                 *)
  604.   difVol1  * = 2;  (* Locks are on different volumes               *)
  605.   difVol2  * = 3;  (* Locks are on different volumes               *)
  606.  
  607. (*
  608.  ************************************************************************
  609.  *      ASyncRun() stuff...                                             *
  610.  ************************************************************************
  611.  * Message sent back on your request by an exiting process.             *
  612.  * You request this by putting the address of your message in           *
  613.  * pcb_LastGasp, and initializing the ReplyPort variable of your        *
  614.  * ZombieMsg to the port you wish the message posted to.                *
  615.  ************************************************************************
  616.  *)
  617.  
  618. TYPE
  619.   ZombieMsg * = STRUCT
  620.     execMessage* : e.Message;
  621.     taskNum* :     LONGINT;     (* Task ID                      *)
  622.     returnCode* :  LONGINT;     (* Process's return code        *)
  623.     result2* :     LONGINT;     (* System return code           *)
  624.     exitTime* :    d.Date;      (* Date stamp at time of exit   *)
  625.     userInfo* :    LONGINT;     (* For whatever you wish        *)
  626.   END;
  627.  
  628. (*
  629.  ************************************************************************
  630.  * Structure required by ASyncRun() -- see docs for more info.          *
  631.  ************************************************************************
  632.  *)
  633.  
  634.   ProcessControlBlock * = STRUCT
  635.     stackSize* : LONGINT;     (* Stacksize for new process             *)
  636.     pri* : SHORTINT;          (* Priority of new task                  *)
  637.     control* : SHORTSET;      (* Control bits, see defines below       *)
  638.     trapCode* : e.ADDRESS;    (* Optional Trap Code                    *)
  639.     input* : e.BPTR;
  640.     output* : e.BPTR;         (* Optional stdin, stdout                *)
  641.     console* : LONGINT;
  642.     loadedCode* : e.ADDRESS;  (* If not null, will not load/unload code*)
  643.     lastGasp* : ZombieMsgPtr; (* ReplyMsg() to be filled in by exit    *)
  644.     wbProcess* : e.MsgPort;   (* Valid only when PRB_NOCLI             *)
  645.   END;
  646.  
  647. (*
  648.  ************************************************************************
  649.  * Formerly needed to pass NULLCMD to a child.  No longer needed.       *
  650.  * It is being kept here for compatibility only...                      *
  651.  ************************************************************************
  652.  *)
  653.  
  654. CONST
  655.   NoCmd * = "\n";
  656.  
  657. (*
  658.  ************************************************************************
  659.  * The following control bits determine what ASyncRun() does on         *
  660.  * Abnormal Exits and on background process termination.                *
  661.  ************************************************************************
  662.  *)
  663.  
  664.   saveio      * = 0;      (* Don't free/check file handles on exit     *)
  665.   closeSplat  * = 1;      (* Close Splat file, must request explicitly *)
  666.   noCLI       * = 2;      (* Don't create a CLI process                *)
  667. (*interactive * = 3;       This is now obsolete...                     *)
  668.   code        * = 4;      (* Dangerous yet enticing                    *)
  669.   stdio       * = 5;      (* Do the stdio thing, splat * = CON:Filename*)
  670.  
  671. (*
  672.  ************************************************************************
  673.  *      Error returns from SyncRun() and ASyncRun()                     *
  674.  ************************************************************************
  675.  *)
  676.  
  677.   noFile    * =  -1;     (* Could not LoadSeg() the file        *)
  678.   noMem     * =  -2;     (* No memory for something             *)
  679. (*noCLI     * =  -3;        This is now obsolete                *)
  680.   noSlot    * =  -4;     (* No room in TaskArray                *)
  681.   noInput   * =  -5;     (* Could not open input file           *)
  682.   noOutPut  * =  -6;     (* Could not get output file           *)
  683. (*noClock   * =  -7;        This is now obsolete                *)
  684. (*argErr    * =  -8;        This is now obsolete                *)
  685. (*noBCPL    * =  -9;        This is now obsolete                *)
  686. (*badLib    * =  -10;       This is now obsolete                *)
  687.   noStdio   * =  -11;    (* Couldn't get stdio handles          *)
  688.  
  689. (*
  690.  ************************************************************************
  691.  *      Added V35 of arp.library                                        *
  692.  ************************************************************************
  693.  *)
  694.  
  695.   wantSMessage * = -12; (* Child wants you to report IoErr() to user   *)
  696.                         (* for SyncRun() only...                       *)
  697.   noShellProc  * = -13; (* Can't create a shell/cli process            *)
  698.   noExec       * = -14; (* 'E' bit is clear                            *)
  699.   script       * = -15; (* S and E are set, IoErr() contains directory *)
  700.  
  701. (*
  702.  ************************************************************************
  703.  * Version 35 ASyncRun() allows you to create an independent            *
  704.  * interactive or background Shell/CLI. You need this variant of the    *
  705.  * pcb structure to do it, and you also have new values for nsh_Control,*
  706.  * see below.                                                           *
  707.  *                                                                      *
  708.  * Syntax for Interactive shell is:                                     *
  709.  *                                                                      *
  710.  * rc=ASyncRun("Optional Window Name","Optional From File",&NewShell);  *
  711.  *                                                                      *
  712.  * Syntax for a background shell is:                                    *
  713.  *                                                                      *
  714.  * rc=ASyncRun("Command line",0L,&NewShell);                            *
  715.  *                                                                      *
  716.  * Same syntax for an Execute style call, but you have to be on drugs   *
  717.  * if you want to do that.                                              *
  718.  ************************************************************************
  719.  *)
  720.  
  721. TYPE
  722.   NewShell * = STRUCT
  723.     stackSize* : LONGINT; (* Stacksize shell will use for children     *)
  724.     pri* : SHORTINT;      (* ignored by interactive shells             *)
  725.     control* : SHORTSET;  (* bits/values* : see above                  *)
  726.     logMsg* : e.ADDRESS;  (* Optional login message, if 0, use default *)
  727.     input* : e.BPTR;      (* ignored by interactive shells, but        *)
  728.     output* : e.BPTR;     (* used by background and execute options.   *)
  729.     reserved* : ARRAY 5 OF LONGINT;
  730.   END;
  731.  
  732. (*
  733.  ************************************************************************
  734.  * Bit Values for nsh_Control, you should use them as shown below, or   *
  735.  * just use the actual values indicated.                                *
  736.  ************************************************************************
  737.  *)
  738.  
  739. CONST
  740.   cli         * = 0;      (* Do a CLI, not a shell        *)
  741.   backGround  * = 1;      (* Background shell             *)
  742.   execute     * = 2;      (* Do as EXECUTE...             *)
  743.   interactive * = 3;      (* Run an interactive shell     *)
  744.   fb          * = 7;      (* Alt function bit...          *)
  745.  
  746. (*
  747.  ************************************************************************
  748.  *      Common values for sh_Control which allow you to do usefull      *
  749.  *      and somewhat "standard" things...                               *
  750.  ************************************************************************
  751.  *)
  752.  
  753. TYPE SS = SHORTSET;
  754.  
  755. CONST
  756.   interactiveShell*=SS{fb,interactive};       (* Gimme a newshell!     *)
  757.   interactiveCli  *=SS{fb,interactive,cli};   (* Gimme that ol newcli! *)
  758.   backGroundShell *=SS{fb,backGround};        (* gimme a backgrnd shell*)
  759.   executeMe       *=SS{fb,backGround,execute};(* aptly named           *)
  760.  
  761. (*
  762.  ************************************************************************
  763.  *      Additional IoErr() returns added by ARP...                      *
  764.  ************************************************************************
  765.  *)
  766.   errorBufferOverflow  * = 303; (* User or internal buffer overflow  *)
  767.   errorBreak           * = 304; (* A break character was received    *)
  768.   errorNotExecuteable  * = 305; (* A file has E bit cleared          *)
  769.   errorNotCLI          * = 400; (* Program/function neeeds to be cli *)
  770.  
  771. (*
  772.  ************************************************************************
  773.  *      Resident Program Support                                        *
  774.  ************************************************************************
  775.  * This is the kind of node allocated for you when you AddResidentPrg() *
  776.  * a code segment.  They are stored as a single linked list with the    *
  777.  * root in ArpBase.  If you absolutely *must* wander through this list  *
  778.  * instead of using the supplied functions, then you must first obtain  *
  779.  * the semaphore which protects this list, and then release it          *
  780.  * afterwards.  Do not use Forbid() and Permit() to gain exclusive      *
  781.  * access!  Note that the supplied functions handle this locking        *
  782.  * protocol for you.                                                    *
  783.  ************************************************************************
  784.  *)
  785.  
  786. TYPE
  787.   ResidentProgramNode * = STRUCT
  788.     next* : ResidentProgramNodePtr;  (* next or NULL                 *)
  789.     usage* : LONGINT;                (* Number of current users      *)
  790.     accessCnt* : INTEGER;            (* Total times used...          *)
  791.     checkSum* : LONGINT;             (* Checksum of code             *)
  792.     segment* : e.BPTR;               (* Actual segment               *)
  793.     flags* : SET;                    (* See definitions below...     *)
  794.  (* name* : ARRAY OF CHAR;              Allocated as needed          *)
  795.   END;
  796.  
  797. (*
  798.  ************************************************************************
  799.  *      Bit definitions for rpn_Flags....                               *
  800.  ************************************************************************
  801.  *)
  802.  
  803. CONST
  804.   noCheck  * =  0;      (* Set in rpn_Flags for no checksumming...   *)
  805.   cache    * =  1;      (* Private usage in v1.3...                  *)
  806.  
  807. (*
  808.  ************************************************************************
  809.  * If your program starts with this structure, ASyncRun() and SyncRun() *
  810.  * will override a users stack request with the value in rpt_StackSize. *
  811.  * Furthermore, if you are actually attached to the resident list, a    *
  812.  * memory block of size rpt_DataSize will be allocated for you, and     *
  813.  * a pointer to this data passed to you in register A4.  You may use    *
  814.  * this block to clone the data segment of programs, thus resulting in  *
  815.  * one copy of text, but multiple copies of data/bss for each process   *
  816.  * invocation.  If you are resident, your program will start at         *
  817.  * rpt_Instruction, otherwise, it will be launched from the initial     *
  818.  * branch.                                                              *
  819.  ************************************************************************
  820.  *)
  821. TYPE ResidentProgramTag * = STRUCT
  822.        nextSeg* : e.BPTR;     (* Provided by DOS at LoadSeg time      *)
  823. (*
  824.  ************************************************************************
  825.  * The initial branch destination and rpt_Instruction do not have to be *
  826.  * the same.  This allows different actions to be taken if you are      *
  827.  * diskloaded or resident.  DataSize memory will be allocated only if   *
  828.  * you are resident, but StackSize will override all user stack         *
  829.  * requests.                                                            *
  830.  ************************************************************************
  831.  *)
  832.        bra* : INTEGER;        (* Short branch to executable           *)
  833.        magic* : INTEGER;      (* Resident majik value                 *)
  834.        stacksize* : LONGINT;  (* min stack for this process           *)
  835.        dataSie* : LONGINT;    (* Data size to allocate if resident    *)
  836.     (* instruction;            Start here if resident          *)
  837.      END;
  838.  
  839. (*
  840.  ************************************************************************
  841.  * The form of the ARP allocated node in your tasks memlist when        *
  842.  * launched as a resident program. Note that the data portion of the    *
  843.  * node will only exist if you have specified a nonzero value for       *
  844.  * rpt_DataSize. Note also that this structure is READ ONLY, modify     *
  845.  * values in this at your own risk.  The stack stuff is for tracking,   *
  846.  * if you need actual addresses or stack size, check the normal places  *
  847.  * for it in your process/task struct.                                  *
  848.  ************************************************************************
  849.  *)
  850.  
  851.   ProcessMemory * = STRUCT
  852.     node* : e.Node;
  853.     num* : INTEGER;       (* This is 1 if no data, two if data    *)
  854.     stack* : e.ADDRESS;
  855.     stackSize* : LONGINT;
  856.     data* : e.ADDRESS;    (* Only here if pm_Num * =* = 2         *)
  857.     dataSize* : LONGINT;
  858.   END;
  859.  
  860. (*
  861.  ************************************************************************
  862.  * To find the above on your memlist, search for the following name.    *
  863.  * We guarantee this will be the only arp.library allocated node on     *
  864.  * your memlist with this name.                                         *
  865.  * i.e. FindName(task->tcb_MemEntry, PMEM_NAME);                        *
  866.  ************************************************************************
  867.  *)
  868.  
  869. CONST
  870.   pMemName * = "ARP_MEM";
  871.  
  872.   residentMagic * = 4AFCH;    (* same as RTC_MATCHWORD (trapf) *)
  873.  
  874. (*
  875.  ************************************************************************
  876.  *      Date String/Data structures                                     *
  877.  ************************************************************************
  878.  *)
  879.  
  880. TYPE
  881.   DateTime * = STRUCT
  882.     stamp* : d.Date;         (* DOS Datestamp                        *)
  883.     format* : s.BYTE;        (* controls appearance ot dat_StrDate   *)
  884.     flags* : SET;            (* See BITDEF's below                   *)
  885.     strDay* : e.ADDRESS;     (* day of the week string               *)
  886.     strData* : e.ADDRESS;    (* date string                          *)
  887.     strTime* : e.ADDRESS;    (* time string                          *)
  888.   END;
  889.  
  890. (*
  891.  ************************************************************************
  892.  *      Size of buffer you need for each DateTime strings:              *
  893.  ************************************************************************
  894.  *)
  895.  
  896. CONST
  897.   lenDatString * = 10;
  898.  
  899. (*
  900.  ************************************************************************
  901.  *      For dat_Flags                                                   *
  902.  ************************************************************************
  903.  *)
  904.  
  905.   subSt  * = 0;  (* Substitute "Today" "Tomorrow" where appropriate  *)
  906.   future * = 1;  (* Day of the week is in future                     *)
  907.  
  908. (*
  909.  ************************************************************************
  910.  *      For dat_Format                                                  *
  911.  ************************************************************************
  912.  *)
  913.  
  914.   formatDos * = 0;        (* dd-mmm-yy AmigaDOS's own, unique style  *)
  915.   formatInt * = 1;        (* yy-mm-dd International format           *)
  916.   formatUSA * = 2;        (* mm-dd-yy The good'ol'USA.               *)
  917.   formatCDN * = 3;        (* dd-mm-yy Our friends to the north       *)
  918.   formatMAX * = formatCDN;(* Larger than this? Defaults to AmigaDOS  *)
  919.  
  920.  
  921. (*
  922.  ************************************************************************
  923.  *  ARP Library Base                                                    *
  924.  ************************************************************************
  925.  *)
  926.  
  927. VAR
  928.   arp *, base * : ArpBasePtr;  (* synonyms *)
  929.  
  930. (*
  931.  ************************************************************************
  932.  *      These duplicate the calls in dos.library                        *
  933.  *      Only include if you can use arp.library without dos.library     *
  934.  ************************************************************************
  935.  *)
  936.  
  937. TYPE PROC * = PROCEDURE();
  938.  
  939. PROCEDURE Close* {arp,- 36}(file{1}:  d.FileHandlePtr);
  940. PROCEDURE CreateDir* {arp,-120}(name{1}: ARRAY OF CHAR): d.FileLockPtr;
  941. PROCEDURE CreateProc* {arp,-138}(name{1}: ARRAY OF CHAR;
  942.                                  pri{2}: LONGINT;
  943.                                  segment{3}: e.BPTR;
  944.                                  stackSize{4}: LONGINT): d.ProcessId;
  945. PROCEDURE CurrentDir* {arp,-126}(lock{1}: d.FileLockPtr): d.FileLockPtr;
  946. PROCEDURE DateStamp* {arp,-192}(VAR v{1}: d.Date);
  947. PROCEDURE Delay* {arp,-198}(ticks{1}: LONGINT);
  948. PROCEDURE DeleteFile* {arp,- 72}(name{1}: ARRAY OF CHAR): BOOLEAN;
  949. PROCEDURE DeviceProc* {arp,-174}(name{1}: ARRAY OF CHAR): d.ProcessId;
  950. PROCEDURE DupLock* {arp,- 96}(lock{1}: d.FileLockPtr): d.FileLockPtr;
  951. PROCEDURE Examine* {arp,-102}(lock{1}: d.FileLockPtr;
  952.            infoBlock{2}: d.FileInfoBlockPtr): BOOLEAN;
  953. PROCEDURE Execute* {arp,-222}(commandString{1}: ARRAY OF CHAR;
  954.            input{2}: d.FileHandlePtr;
  955.            output{3}: d.FileHandlePtr): LONGINT;
  956. PROCEDURE Exit* {arp,-144}(returnCode{1}: LONGINT);
  957. PROCEDURE ExNext* {arp,-108}(lock{1}: d.FileLockPtr;
  958.            infoBlock{2}: d.FileInfoBlockPtr): BOOLEAN;
  959. PROCEDURE GetPacket* {arp,-162}(wait{1}: LONGINT): d.DosPacketPtr;
  960. PROCEDURE Info* {arp,-114}(lock{1}: d.FileLockPtr;
  961.            parameterBlock{2}: d.InfoDataPtr): BOOLEAN;
  962. PROCEDURE Input* {arp,- 54}(): d.FileHandlePtr;
  963. PROCEDURE IoErr* {arp,-132}(): LONGINT;
  964. PROCEDURE IsInteractive* {arp,-216}(file{1}: d.FileHandlePtr): BOOLEAN;
  965. PROCEDURE LoadSeg* {arp,-150}(name{1}: ARRAY OF CHAR): e.BPTR;
  966. PROCEDURE Lock* {arp,- 84}(name{1}: ARRAY OF CHAR;
  967.                accessMode{2}: LONGINT): d.FileLockPtr;
  968. PROCEDURE Open* {arp,- 30}(name{1}: ARRAY OF CHAR;
  969.            accessMode{2}: LONGINT): d.FileHandlePtr;
  970. PROCEDURE Output* {arp,- 60}(): d.FileHandlePtr;
  971. PROCEDURE ParentDir* {arp,-210}(lock{1}: d.FileLockPtr): d.FileLockPtr;
  972. PROCEDURE QueuePacket* {arp,-168}(packet{1}: d.DosPacketPtr): LONGINT;
  973. PROCEDURE Read* {arp,- 42}(file{1}: d.FileHandlePtr;
  974.                buffer{2}: ARRAY OF s.BYTE;
  975.                length{3}: LONGINT): LONGINT;
  976. PROCEDURE Rename* {arp,- 78}(oldName{1},newName{2}: ARRAY OF CHAR): BOOLEAN;
  977. PROCEDURE Seek* {arp,- 66}(file{1}: d.FileHandlePtr;
  978.                position{2}: LONGINT;
  979.                mode{3}: LONGINT): LONGINT;
  980. PROCEDURE SetComment* {arp,-180}(name{1},comment{2}: ARRAY OF CHAR): BOOLEAN;
  981. PROCEDURE SetProtection* {arp,-186}(name{1}: ARRAY OF CHAR;
  982.                                     mask{2}: LONGSET (* ProtectionFlags *)
  983.                                     ): BOOLEAN;
  984. PROCEDURE UnLoadSeg* {arp,-156}(segment{1}: e.BPTR);
  985. PROCEDURE UnLock* {arp,- 90}(lock{1}: d.FileLockPtr);
  986. PROCEDURE WaitForChar* {arp,-204}(file{1}: d.FileHandlePtr;
  987.                                   timeout{2}: LONGINT): BOOLEAN;
  988. PROCEDURE Write* {arp,- 48}(file{1}: d.FileHandlePtr;
  989.                             buffer{2}: ARRAY OF s.BYTE;
  990.                             length{3}: LONGINT): LONGINT;
  991.  
  992.  
  993. (*
  994.  ************************************************************************
  995.  *      Now for the stuff that only exists in arp.library...            *
  996.  ************************************************************************
  997.  *)
  998.  
  999. PROCEDURE AddDADevs* {arp,-516}(dalist{8}: DirectoryEntryPtr;
  1000.                     select{0}: LONGSET (* DirEntryType *)): LONGINT;
  1001. PROCEDURE AddDANode* {arp,-510}(data{8}: e.ADDRESS;
  1002.                     dalist{9}: DirectoryEntryPtr;
  1003.                     length{0}: LONGINT;
  1004.                     id{1}: LONGSET (* DirEntryType *)): DirectoryEntryPtr;
  1005. PROCEDURE AddResidentPrg* {arp,-582}(segment{1}: e.BPTR;
  1006.                          name{8}: ARRAY OF CHAR): ResidentProgramNodePtr;
  1007. PROCEDURE ArpAlloc* {arp,-384}(size{0}: LONGINT): e.ADDRESS;
  1008. PROCEDURE ArpAllocMem* {arp,-390}(size{0}: LONGINT;
  1009.                       reqs{1}: LONGSET (* e.MemReqs *)): e.ADDRESS;
  1010. PROCEDURE ArpDupLock* {arp,-402}(lock{1}: d.FileLockPtr): d.FileLockPtr;
  1011. PROCEDURE ArpExit* {arp,-378}(returncode{0}: LONGINT;
  1012.                   fault{2}: LONGINT);
  1013. PROCEDURE ArpLock* {arp,-408}(name{1}: ARRAY OF CHAR;
  1014.                   accessMode{2}: LONGINT): d.FileLockPtr;
  1015. PROCEDURE ArpOpen* {arp,-396}(name{1}: ARRAY OF CHAR;
  1016.                   accessmode{2}: LONGINT): d.FileHandlePtr;
  1017. PROCEDURE Assign* {arp,-336}(name{8}: ARRAY OF CHAR;
  1018.                  phys{9}: ARRAY OF CHAR): LONGINT;
  1019. PROCEDURE ASyncRun* {arp,-546}(command{8}: ARRAY OF CHAR;
  1020.                    args{9}: ARRAY OF CHAR;
  1021.                    pcb{10}: ProcessControlBlockPtr): LONGINT;
  1022. PROCEDURE Atol* {arp,-258}(string{8}: ARRAY OF CHAR): LONGINT;
  1023. PROCEDURE BaseName* {arp,-630}(pathname{8}: ARRAY OF CHAR): e.ADDRESS;
  1024. PROCEDURE BtoCStr* {arp,-354}(cstring{8}: ARRAY OF CHAR;
  1025.                   bstr{0}: d.BSTR;
  1026.                   maxlength{1}: LONGINT): LONGINT;
  1027. PROCEDURE CheckAbort* {arp,-270}(func{9}: PROC): LONGSET;
  1028. PROCEDURE CheckBreak* {arp,-276}(mask{1}: LONGSET;
  1029.                      func{9}: PROC): LONGSET;
  1030. PROCEDURE CheckSumPrg* {arp,-618}(
  1031.                   node{1}: ResidentProgramNodePtr): LONGINT;
  1032. PROCEDURE CloseWindowSafely* {arp,-300}(window{8}: I.WindowPtr;
  1033.                             morewindows{9}: BOOLEAN);
  1034. PROCEDURE CompareLock* {arp,-456}(
  1035.                   lock1{0},lock2{1}: d.FileLockPtr): LONGINT;
  1036. PROCEDURE CreatePort* {arp,-306}(name{8}: e.ADDRESS;
  1037.                      priority{0}: SHORTINT): e.MsgPortPtr;
  1038. PROCEDURE CreateTaskResList* {arp,-468}(): ResListPtr;
  1039. PROCEDURE CtoBStr* {arp,-360}(cstring{8}: ARRAY OF CHAR;
  1040.                   bstr{0}: d.BSTR;
  1041.                   maxlength{1}: LONGINT): LONGINT;
  1042. PROCEDURE DeletePort* {arp,-312}(port{9}: e.MsgPortPtr);
  1043. PROCEDURE DosAllocMem* {arp,-342}(size{0}: LONGINT): e.ADDRESS;
  1044. PROCEDURE DosFreeMem* {arp,-348}(memBlk{9}: e.ADDRESS);
  1045. PROCEDURE EscapeString* {arp,-264}(string{8}: ARRAY OF CHAR): LONGINT;
  1046. PROCEDURE FileRequest* {arp,-294}(
  1047.                   filereq{8}: FileRequesterPtr): e.ADDRESS;
  1048. PROCEDURE FindCLI* {arp,-420}(tasknum{0}: LONGINT): d.ProcessPtr;
  1049. PROCEDURE FindFirst* {arp,-438}(pat{0}: ARRAY OF CHAR;
  1050.                     chain{8}: AnchorPathPtr): LONGINT;
  1051. PROCEDURE FindNext* {arp,-444}(chain{8}: AnchorPathPtr): LONGINT;
  1052. PROCEDURE FindTaskResList* {arp,-462}(): ResListPtr;
  1053. PROCEDURE VFPrintf* {arp,-234}(file{0}: d.FileHandlePtr;
  1054.                   string{8}: ARRAY OF CHAR;
  1055.                   argarray{9}: ARRAY OF e.APTR): LONGINT;
  1056. PROCEDURE FPrintf* {arp,-234}(file{0}: d.FileHandlePtr;
  1057.                   string{8}: ARRAY OF CHAR;
  1058.                   args{9}..: e.APTR): LONGINT;
  1059. PROCEDURE FreeAccess* {arp,-498}(tracker{9}: DefaultTrackerPtr);
  1060. PROCEDURE FreeAnchorChain* {arp,-450}(chain{8}: AnchorPathPtr);
  1061. PROCEDURE FreeDAList* {arp,-504}(dalist{9}: e.ADDRESS);
  1062. PROCEDURE FreeResList* {arp,-474}(freelist{9}: e.ADDRESS);
  1063. PROCEDURE FreeTaskResList* {arp,-372}(): BOOLEAN;
  1064. PROCEDURE FreeTrackedItem* {arp,-480}(item{9}: DefaultTrackerPtr);
  1065. PROCEDURE GADS* {arp,-252}(cmdLine{8}: ARRAY OF CHAR;
  1066.                cmdLen{0}: LONGINT;
  1067.                help{9}: ARRAY OF CHAR;
  1068.                argarray{10}: e.ADDRESS;
  1069.                tplate{11}: ARRAY OF CHAR): LONGINT;
  1070. PROCEDURE GetAccess* {arp,-492}(
  1071.                tracker{9}: DefaultTrackerPtr): DefaultTrackerPtr;
  1072. PROCEDURE GetDevInfo* {arp,-366}(
  1073.                devinfo{10}: d.DeviceListPtr): d.DeviceListPtr;
  1074. PROCEDURE GetEnv* {arp,-282}(string{8}: ARRAY OF CHAR;
  1075.                  buffer{9}: ARRAY OF CHAR;
  1076.                  size{0}: LONGINT): e.ADDRESS;
  1077. PROCEDURE GetTracker* {arp,-486}(id{9}: LONGINT): DefaultTrackerPtr;
  1078. PROCEDURE InitStdPacket* {arp,-324}(action{0}: LONGINT;
  1079.                         args{8}: e.ADDRESS;
  1080.                         packet{9}: e.ADDRESS;
  1081.                         replyport{10}: e.MsgPortPtr);
  1082. PROCEDURE LDiv* {arp,-606}(dividend{0},divisor{1}: LONGINT): LONGINT;
  1083. PROCEDURE LMod* {arp,-612}(dividend{0},divisor{1}: LONGINT): LONGINT;
  1084. PROCEDURE LMult* {arp,-600}(num1{0},num2{1}: LONGINT): LONGINT;
  1085. PROCEDURE LoadPrg* {arp,-552}(name{1}: ARRAY OF CHAR): e.BPTR;
  1086. PROCEDURE ObtainResidentPrg* {arp,-576}(
  1087.                    name{8}: ARRAY OF CHAR): ResidentProgramNodePtr;
  1088. PROCEDURE PathName* {arp,-330}(lock{0}: d.FileLockPtr;
  1089.                    VAR dest{8}: ARRAY OF CHAR;
  1090.                    numberNames{1}: LONGINT): LONGINT;
  1091. PROCEDURE PatternMatch* {arp,-432}(pat{8}: ARRAY OF CHAR;
  1092.                        str{9}: ARRAY OF CHAR): BOOLEAN;
  1093. PROCEDURE PreParse* {arp,-558}(source{8}: ARRAY OF CHAR;
  1094.                    dest{9}: ARRAY OF CHAR): BOOLEAN;
  1095. PROCEDURE VPrintf* {arp,-228}(string{8}: ARRAY OF CHAR;
  1096.                  argarray{9}: ARRAY OF e.ADDRESS): LONGINT;
  1097. PROCEDURE Printf* {arp,-228}(string{8}: ARRAY OF CHAR;
  1098.                  args{9}..: e.APTR): LONGINT;
  1099. PROCEDURE Puts* {arp,-240}(string{9}: ARRAY OF CHAR): LONGINT;
  1100. PROCEDURE QSort* {arp,-426}(baseptr{8}: e.ADDRESS;
  1101.                 regionsize{0}: LONGINT;
  1102.                 bytesize{1}: LONGINT;
  1103.                 userfunction{9}: PROC): BOOLEAN;
  1104. PROCEDURE ReadLine* {arp,-246}(buffer{8}: ARRAY OF s.BYTE): LONGINT;
  1105. PROCEDURE ReleaseResidentPrg* {arp,-636}(segment{1}: e.BPTR):
  1106.                                       ResidentProgramNodePtr;
  1107. PROCEDURE RemResidentPrg* {arp,-588}(name{8}: ARRAY OF CHAR): LONGINT;
  1108. PROCEDURE RListAlloc* {arp,-414}(reslist{8}: ResListPtr;
  1109.                      size{0}: LONGINT): e.ADDRESS;
  1110. PROCEDURE SendPacket* {arp,-318}(action{0}: LONGINT;
  1111.                      args{8}: e.ADDRESS;
  1112.                      handler{9}: e.MsgPortPtr): LONGINT;
  1113. PROCEDURE SetEnv* {arp,-288}(string{8}: ARRAY OF CHAR;
  1114.                  buffer{9}: ARRAY OF CHAR): BOOLEAN;
  1115. PROCEDURE StampToStr* {arp,-564}(datetime{8}: d.DatePtr): BOOLEAN;
  1116. PROCEDURE Strcmp* {arp,-522}(s1{8},s2{9}: ARRAY OF CHAR): LONGINT;
  1117. PROCEDURE Strncmp* {arp,-528}(st{8},s2{9}: ARRAY OF CHAR;
  1118.                   n{0}: LONGINT): LONGINT;
  1119. PROCEDURE StrToStamp* {arp,-570}(datetime{8}: d.DatePtr): BOOLEAN;
  1120. PROCEDURE SyncRun* {arp,-540}(filename{8}: ARRAY OF CHAR;
  1121.                   args{9}: ARRAY OF CHAR;
  1122.                   input{0}: d.FileHandlePtr;
  1123.                   output{1}: d.FileHandlePtr): LONGINT;
  1124. PROCEDURE TackOn* {arp,-624}(pathname{8},filename{9}: ARRAY OF CHAR);
  1125. PROCEDURE ToUpper* {arp,-534}(old{0}: CHAR): CHAR;
  1126. PROCEDURE UnLoadPrg* {arp,-594}(segment{1}: e.BPTR);
  1127.  
  1128. PROCEDURE SPrintf* {arp,-642}(file{0}: e.ADDRESS;
  1129.                             str{8}: ARRAY OF CHAR;
  1130.                             stream{9}: e.ADDRESS): LONGINT;
  1131. PROCEDURE GetKeywordIndex* {arp,-648}(
  1132.                   str1{8},str2{9}: ARRAY OF CHAR): LONGINT;
  1133. PROCEDURE ArpOpenLibrary* {arp,-654}(name{9}: ARRAY OF CHAR;
  1134.                                    vers{0}: LONGINT): e.LibraryPtr;
  1135. PROCEDURE ArpAllocFreq* {arp,-660}(): FileRequesterPtr;
  1136.  
  1137.  
  1138. (* $OvflChk- $RangeChk- $StackChk- $NilChk- $ReturnChk- $CaseChk- *)
  1139.  
  1140. BEGIN
  1141.  arp := e.OpenLibrary(arpName,arpVersion);
  1142.  IF arp = NIL THEN
  1143.    IF I.DisplayAlert(0,"\x00\x64\x14missing arp.library V39\o\o",50) THEN END;
  1144.    HALT(d.fail)
  1145.  END;
  1146.  base := arp;
  1147.  
  1148. CLOSE
  1149.  IF arp#NIL THEN e.CloseLibrary(arp) END;
  1150.  
  1151. END ARP.
  1152.  
  1153.